import Layout from '../views/Main.vue'
import Login from '../views/login/index.vue'
import { createRouter, createWebHashHistory } from 'vue-router'

import Order from '../views/vppz/order/index.vue'
import Staff from '../views/vppz/staff/index.vue'
import Group from '../views/auth/group/index.vue'
import Admin from '../views/auth/admin/index.vue'
import Dashboard from '../views/dashboard/index.vue'

//const localData = localStorage.getItem('pz_v3pz')

const routes = [
    {
        path:'/',
        component: Layout,
        name:'main',
        //redirect:to => {
        //    if(localData){
        //        const child = JSON.parse(localData).menu.routerList[0].children
        //        if(child){
        //            return child[0].meta.path
        //        }else{
        //            return  JSON.parse(localData).menu.routerList[0].meta.path
        //        }
        //    }else{
        //        return '/'
        //    }
        //},
        children:[]
    },
    {
        path:'/login',
        component: Login
    }
]

const router = createRouter({
    //路由的模式和数据，一般开发用HASH哈希模式，它可以不刷新直接更新页面的内容，不访问后台
    //Memory模式一般使用在服务端上
    //HTML5模式也称为history模式一般在上线前用
    routes,
    history:createWebHashHistory()
})

export default router